package dto;

import cn.afterturn.easypoi.entity.ImageEntity;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mind
 */
@Data
public class ProcessModelOverviewDto {

    private String id;

    private String code;

    private String name;

    private String elementType;

    private String url;

    private ImageEntity image;

    private String state;

    private List<ProcessModelOverviewDto> children = new ArrayList<>();

    private List<ProcessModelOverviewDto> children2 = new ArrayList<>();

    public ProcessModelOverviewDto() {
    }

    public ProcessModelOverviewDto(String id, String elementType) {
        this.id = id;
        this.elementType = elementType;
    }

    public ImageEntity getImage() {
        ImageEntity image = new ImageEntity();
        image.setHeight(200);
        image.setWidth(500);
        image.setUrl(getUrl());
        image.setType(ImageEntity.URL);
        return image;
    }

    public String getUrl() {
//        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        // get the request
//        HttpServletRequest request = requestAttributes.getRequest();
//        String header = request.getHeader(WebHeaderCode.X_USER_TOKEN);
//        return url + header;
        return url + "NzM1ZmYwOTZjOTkxNTdkY2JkZThhOWVhZjRhM2M2MTE=";
    }
}
